from rest_framework import status
from dataclasses import dataclass


@dataclass
class ErrorData:
    """标准错误数据结构"""

    success: bool = False
    status: int = status.HTTP_500_INTERNAL_SERVER_ERROR
    error: str = "Internal server error"

    def to_dict(self):
        """转换为字典格式"""
        return {"success": self.success, "status": self.status, "error": self.error}
